import { get, post, message } from '@/utils'
interface Roles {
  roleName: string
  roleAlias: string
  sort: number
  id: any
}
export default () => {
  const list = ref<Roles[]>([])
  const getList = (cb?) => {
    get({ url: '/server-system/admin/role/list' }, ({ data }) => {
      list.value = data
      cb?.()
    })
  }
  const remove = (id, cb?) => {
    post({ url: '/server-system/admin/role/remove?ids=' + id }, ({ code, msg }) => {
      cb?.(code == 200)

      message({
        type: code == 200 ? 'success' : 'error',
        content: msg,
      })
    })
  }
  return { list, getList, remove }
}
